using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows.Forms;

namespace VisualStudioMruFileUtil
{
	public partial class AboutForm : Form
	{
		public AboutForm()
		{
			InitializeComponent();
		}

		private void linkLabelWeb_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			try
			{
				LaunchHomePage();
			}
			catch ( Exception ex )
			{
				MessageBox.Show( "Error: " + ex.Message, "Error",
				                 MessageBoxButtons.OK, MessageBoxIcon.Error );
			}
		}

		private void AboutForm_Load(object sender, EventArgs e)
		{
			try
			{
				SetVersionText();
			}
			catch
			{
				labelVersion.Text = "Error getting version.";
			}
		}

		private void SetVersionText()
		{
			Assembly A = typeof ( AboutForm ).Assembly;
			Version version = A.GetName().Version;

			labelVersion.Text = "Version " + version;
		}

		private void LaunchHomePage()
		{
			Process.Start( "http://www.michaelckennedy.net/" );
		}
	}
}